home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8932 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: locutus.rchland.ibm.com!usenet
  2. From: Philip Staite <pstaite+@rchland.ibm.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: assignment operator and inheritance
  5. Date: Tue, 27 Feb 1996 08:12:05 -0600
  6. Organization: IBM Rochester, MN
  7. Message-ID: <31331135.446B@rchland.ibm.com>
  8. References: <candymanDn9C6L.Lq2@netcom.com>
  9. NNTP-Posting-Host: powertool.rchland.ibm.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (X11; I; AIX 1)
  14.  
  15. candyman@netcom.com wrote:
  16.  
  17. > If I have base and child classes, where the child class is
  18. > derived from the base class.  What is the syntax to use the
  19. > base class's assignment operator within the child class's
  20. > assignment operator definition?.
  21.  
  22. derived_type& derived_type::operator=( const derived_type& d ) {
  23.     base_type::operator=( d );  // assign base part
  24.     // do other stuff here such as assign
  25.     // instance data from derived_type
  26.     return *this; }
  27.  
  28.  
  29. -- 
  30.  
  31. Phil Staite, (507) 253-2529, team OS/2
  32. internet: pstaite@vnet.ibm.com  internal: pstaite@rchland
  33.